home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / SpeakFreely / src / lpc10 / preemp.c < prev    next >
C/C++ Source or Header  |  2000-05-18  |  755b  |  36 lines

  1. /********************************************************************
  2. *
  3. *    PREEMP Version 48
  4. *
  5. ********************************************************************
  6. *
  7. *   Preemphasize speech with      ( 1 - .9375z**-1 )  [old preemphasis]
  8. *   cascaded with ( 1 + .2z**-1 ) / ( 1 + .5z**-1 )   [6 db/oct ramp]
  9. *
  10. * Inputs:
  11. *  NSAMP  - Number of samples to filter
  12. *  INBUF  - Input speech buffer
  13. *  COEF      - Preemphasis coeficient
  14. * Output:
  15. *  PEBUF  - Preemphasized speech buffer (can be equal to INBUF)
  16. *  Z      - Filter state
  17. */
  18.  
  19. preemp( inbuf, pebuf, nsamp, coef, z )
  20. int nsamp;
  21. float *inbuf, *pebuf, coef, *z;
  22. {
  23. int i;
  24. float temp=0.0;
  25.  
  26.  
  27. for(i=1; i<=nsamp; i++) {
  28.     temp = inbuf[i] - *z + coef**(z+1);
  29.     *(z+1) = *z;
  30.     *z = inbuf[i];
  31.     pebuf[i] = temp;
  32. }
  33.  
  34.  
  35. }
  36.